package com.huizu.project.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.huizu.common.annotation.Log;
import com.huizu.common.core.controller.BaseController;
import com.huizu.common.core.domain.AjaxResult;
import com.huizu.common.enums.BusinessType;
import com.huizu.project.domain.ProXx;
import com.huizu.project.service.IProXxService;
import com.huizu.common.utils.poi.ExcelUtil;
import com.huizu.common.core.page.TableDataInfo;

/**
 * 学校管理Controller
 * 
 * @author zhangmx
 * @date 2024-05-28
 */
@RestController
@RequestMapping("/project/proxx")
public class ProXxController extends BaseController
{
    @Autowired
    private IProXxService proXxService;

    /**
     * 查询学校管理列表
     */
    //@PreAuthorize("@ss.hasPermi('project:proxx:list')")
    @GetMapping("/list")
    public TableDataInfo list(ProXx proXx)
    {
        startPage();
        List<ProXx> list = proXxService.selectProXxList(proXx);
        return getDataTable(list);
    }

    /**
     * 查询学校管理列表
     */
    //@PreAuthorize("@ss.hasPermi('project:proxx:list')")
    @GetMapping("/listTotal")
    public TableDataInfo listTotal(ProXx proXx)
    {
        List<ProXx> list = proXxService.selectProXxList(proXx);
        return getDataTable(list);
    }

    /**
     * 导出学校管理列表
     */
    @PreAuthorize("@ss.hasPermi('project:proxx:export')")
    @Log(title = "学校管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ProXx proXx)
    {
        List<ProXx> list = proXxService.selectProXxList(proXx);
        ExcelUtil<ProXx> util = new ExcelUtil<ProXx>(ProXx.class);
        util.exportExcel(response, list, "学校管理数据");
    }

    /**
     * 获取学校管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('project:proxx:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(proXxService.selectProXxById(id));
    }

    /**
     * 新增学校管理
     */
    @PreAuthorize("@ss.hasPermi('project:proxx:add')")
    @Log(title = "学校管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ProXx proXx)
    {
        return toAjax(proXxService.insertProXx(proXx));
    }

    /**
     * 修改学校管理
     */
    @PreAuthorize("@ss.hasPermi('project:proxx:edit')")
    @Log(title = "学校管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ProXx proXx)
    {
        return toAjax(proXxService.updateProXx(proXx));
    }

    /**
     * 删除学校管理
     */
    @PreAuthorize("@ss.hasPermi('project:proxx:remove')")
    @Log(title = "学校管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(proXxService.deleteProXxByIds(ids));
    }
}
